/**
 * zmn员工模块-IP白名单编辑
 * 文件命名格式：zmn.模块.表/功能.js
 * @author heguanghua
 * @since 2020/05/10 18:14
 */
layui.define(['form', 'zmnApp'], function (exports) {
    let $ = layui.$;
    let form = layui.form;
    let layer = layui.layer;
    let zmnApp = layui.zmnApp;

    form.render(null, "zmn-form");

    // 获取弹出窗口索引
    var index = parent.layer.getFrameIndex(window.name);

    // 提交
    form.on('submit(zmn-form-submit)', function(obj){
        let data = obj.field;
        let url = zmnApp.SYS_BASE_URL +"/staff/modify/setWhitelist.action";
        let jumpStop = false;
        $.ajax({
            async: false,
            type: "POST", url: url,
            dataType: "json", data: data,
            success:function(json) {
                layer.msg(json.message);
                setTimeout(function(){
                    parent.layer.close(index)
                }, 1500);
                return;
            },
            error:function(XMLHttpRequest, tstaffStatus, errorThrown){}
        })
        return false;
    });
    
    //对外暴露的接口
    exports('staff_detail_whitelist', {});
});